//
//  CZDetailNoDataCell.swift
//  GZWeibo05
//
//  Created by zhangping on 15/11/23.
//  Copyright © 2015年 zhangping. All rights reserved.
//

import UIKit

class CZDetailNoDataCell: UITableViewCell {
    
    // MARK: - 属性
    /// 消息内容
    var message: String? {
        didSet {
            messageLabel.text = message
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        backgroundColor = UIColor.clearColor()
        prepareUI()
    }
    
    private func prepareUI() {
        // 添加子控件
        contentView.addSubview(messageLabel)
        
        // 添加约束
        messageLabel.translatesAutoresizingMaskIntoConstraints = false
        
        contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[ml]-0-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["ml": messageLabel]))
        contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-0-[ml(100)]-0-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["ml": messageLabel]))
    }

    // MARK: - 懒加载
    private lazy var messageLabel: UILabel = {
        let label = UILabel()
        
        label.textAlignment = NSTextAlignment.Center
        label.textColor = UIColor.lightGrayColor()
        label.font = UIFont.systemFontOfSize(14)
        label.backgroundColor = UIColor.whiteColor()
        
        return label
    }()
}
